{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">新闻管理</li>
            <li class=""><a href="{:url('admin/product/add')}">新闻添加</a></li>
        </ul>
        <div class="layui-tab-content">

            <form class="layui-form layui-form-pane" action="{:url('admin/product/index')}" method="get">
                <div class="layui-inline">
                    <label class="layui-form-label">分类</label>
                    <div class="layui-input-inline">
                        <select name="cid">
                            <option value="0">全部</option>
                            {foreach name="navlist" item="vo"}
                                <option value="{$vo.id}" {if condition="$cid==$vo.id"} selected="selected"{/if}>{neq name="vo.level" value="1"}|{php}for($i=1;$i<$vo['level'];$i++){echo ' ----';}{/php}{/neq} {$vo.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">关键词</label>
                    <div class="layui-input-inline">
                        <input type="text" name="keyword" value="{$keyword}" placeholder="请输入关键词" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn">搜索</button>
                </div>
            </form>
            <hr>

            <form action="" method="post" class="ajax-form">
                <button type="button" class="layui-btn layui-btn-small ajax-action" data-action="{:url('admin/product/toggle',['type'=>'audit'])}">显示</button>
                <button type="button" class="layui-btn layui-btn-warm layui-btn-small ajax-action" data-action="{:url('admin/product/toggle',['type'=>'cancel_audit'])}">不显示</button>
                <button type="button" class="layui-btn layui-btn-small ajax-action" data-action="{:url('admin/product/zhiding',['type'=>'audit'])}">置顶</button>
                <button type="button" class="layui-btn layui-btn-warm layui-btn-small ajax-action" data-action="{:url('admin/product/zhiding',['type'=>'cancel_audit'])}">取消置顶</button>
                <button type="button" class="layui-btn layui-btn-danger layui-btn-small ajax-action" data-action="{:url('admin/product/delete')}">删除</button>
                <div class="layui-tab-item layui-show">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th style="width: 15px;"><input type="checkbox" class="check-all"></th>
                            <th style="width: 30px;">ID</th>
                            <th>所属导航栏</th>
                            <th>标题</th>
                            <th>缩略图</th>
                            <!-- <th>内容</th> -->
                            <th>阅读量</th>
                            <th>状态</th>
                            <th>置顶</th>
                            <th>发布时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                            {foreach name="newslist" item="vo"}
                                <tr>
                                    <td><input type="checkbox" name="ids[]" value="{$vo.id}"></td>
                                    <td>{$vo.id}</td>
                                    <td>{$vo.nav_id}</td>
                                    <td>{$vo.title}</td>
                                    <td>{if $vo.thumb}<img src="{$vo.thumb}" style="width:60px">{/if}</td>
                                    <!-- <td>{$vo.content}</td> -->
                                    <td>{$vo.readnumber}</td>
                                    <td>{if $vo.status==1}已显示{else /}没显示{/if}</td>
                                    <td>{php}echo $vo['top']==1 ? '已置顶' : '未置顶';{/php}</td>
                                    <td>{$vo.create_time}</td>
                                    <td>
                                        <a href="{:url('admin/product/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>
                                        <a href="{:url('admin/product/delete',['id'=>$vo['id']])}" class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>
                                    </td>
                                </tr>

                            {/foreach} 
                            
                        </tbody>
                    </table>
                    <!--分页-->
                    {$newslist->render()}
                </div>
            </form>
        </div>
    </div>
</div>
{/block}